package model;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2023-06-11
 * Time: 21:48
 */
//这个类表示数据库中blog表的内容
    //每个blog对象表示blog表的每一条记录
public class Blog {
        private int blogId;
        private String title;
        private String content;
        private int userId;
        private Timestamp PostTime;

    public int getBlogId() {
        return blogId;
    }

    public void setBlogId(int blogId) {
        this.blogId = blogId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

//    public Timestamp getPostTime() {
//        return PostTime;//返回的是时间戳,所以构造的内容就是时间戳
//    }
    public  String getPostTime(){
        SimpleDateFormat  format=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        return format.format(PostTime);
    }

    public void setPostTime(Timestamp postTime) {
        PostTime = postTime;
    }
}
